import http from './axios'

// 登陆接口
interface userLogin {
    email:string,
    password:string
}
// 登陆  获取token
function setlogin(obj:userLogin){
    let data=http.post('user/login',obj);
    return data;
}

// 获取用户基本信息
function getuserinfo(){
    let data=http.get('user/current');
    return data
}

// 获取专栏信息
interface currentInfo{
    currentPage:string | number,
    pageSize:string | number
}
function getcolumns(obj:currentInfo){
    let data=http.get(`columns?currentPage=${obj.currentPage}&pageSize=${obj.pageSize}`);
    return data
}

// 专栏详情
interface columnsDetail {
  id: string;
  currentPage: number | string;
  pageSize: number | string;
}

function columnsdetail(obj: columnsDetail) {
    let data = http.get(
      `columns/${obj.id}/posts?currentPage=${obj.currentPage}&pageSize=${obj.pageSize}`
    );
  return data;
}






export { setlogin, getuserinfo, getcolumns, columnsdetail };
